/*

 */

#import <objc/runtime.h>
#import "UIView+Margin.h"

@implementation UIView (Margin)

NSString const *redefined_key_top = @"uiview.topmargin";
NSString const *redefined_key_bottom = @"uiview.bottommargin";

- (void) setTopMargin:(float)topMargin{
    objc_setAssociatedObject(self, &redefined_key_top, [NSNumber numberWithFloat:topMargin], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (float) topMargin{
    if(objc_getAssociatedObject(self, &redefined_key_top) != nil)
        return [objc_getAssociatedObject(self, &redefined_key_top) floatValue];
    else
        return 0.0;
}

- (void) setBottomMargin:(float)bottomMargin{
    objc_setAssociatedObject(self, &redefined_key_bottom, [NSNumber numberWithFloat:bottomMargin], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (float) bottomMargin{
    if(objc_getAssociatedObject(self, &redefined_key_bottom) != nil)
        return [objc_getAssociatedObject(self, &redefined_key_bottom) floatValue];
    else
        return 0.0;
}



@end
